package com.atguigu.gulimall.order.config;

import com.atguigu.gulimall.order.interceptor.LoginUserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @Classname OrderWebConfiguration
 * @Description TODO
 * @Date 2021/10/13 21:08
 * @Author Anonymous
 */
@Configuration
public class OrderWebConfiguration implements WebMvcConfigurer {

    @Resource
    LoginUserInterceptor interceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //项目中的所有请求都要用这个拦截器进行拦截
        registry.addInterceptor(interceptor).addPathPatterns("/**");
    }
}
